//
//  PKRadioMainListTableViewCell.m
//  PianKe
//
//  Created by lanou on 15/10/4.
//  Copyright (c) 2015年 李伟伟. All rights reserved.
//

#import "PKRadioMainListTableViewCell.h"
#import <UIImageView+WebCache.h>
@implementation PKRadioMainListTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
   self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _mainImageView = [[UIImageView alloc]init];
        _mainImageView.frame = CGRectMake(5, 5, SCREEN_WITDTH/5, SCREEN_WITDTH/5);
        [self.contentView addSubview:_mainImageView];
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WITDTH/5 + 10, 10, 100, 20)];
        _titleLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_titleLabel];
        
        _unameLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WITDTH/5 + 10, SCREEN_WITDTH/5-40, 100, 20)];
        _unameLabel.font = [UIFont systemFontOfSize:10];
        _unameLabel.textColor  = [UIColor blueColor];
        [self.contentView addSubview:_unameLabel];
        
        _descLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WITDTH/5 + 10, SCREEN_WITDTH/5-15, SCREEN_WITDTH * 4/5 - 10, 20)];
        _descLabel.font = [UIFont systemFontOfSize:10];
        [self.contentView addSubview:_descLabel];
        
        _countLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WITDTH - 60, 10, 80, 20)];
        _countLabel.font = [UIFont systemFontOfSize:10];
        [self.contentView addSubview:_countLabel];
        
        _soundView = [[UIImageView alloc]init];
        _soundView.frame = CGRectMake(SCREEN_WITDTH-75, 10, 15, 20);
        [self.contentView addSubview:_soundView];
        
        
    }
    return self;
}

//重写setter方法  然后在setter内部给cell控件赋值
-(void)setConfigureModel:(PKRadioMainListModel *)configureModel
{
    _configureModel = configureModel;
    [_mainImageView sd_setImageWithURL:[NSURL URLWithString:configureModel.coverimg]];
    _titleLabel.text = configureModel.title;
    _descLabel.text = configureModel.desc;
    _unameLabel.text = [@"by:" stringByAppendingString:configureModel.userinfo[@"uname"]];;
    _countLabel.text = [NSString stringWithFormat:@"%@", configureModel.count];
    _soundView.image = [UIImage imageNamed:@"声音"];
    
    
}

+(CGFloat)heightForCell
{
    return SCREEN_WITDTH/5 + 10 ;
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
